ClientEvents.tick(event=>{
    updateSchedule()
})

const ClientSchedule= Utils.newList()

function waitRunable(/**@type {Number}*/time,/**@type {Function}*/runable){
    /**@type {Number}*/
    this.time=time
    /**@type {Function}*/
    this.runable=runable
    this.finish=false
    ClientSchedule.push(this)
}

waitRunable.prototype.tick = function(){
    this.time--
    if (this.time<=0) {
        this.runable()
        this.finish=true
    }
}

function updateSchedule() {
    /**@type {Internal.Iterator<any>}*/
    var iterator = ClientSchedule.iterator()
    while (iterator.hasNext()) {
        var runable = iterator.next()
        runable.tick()
        if (runable.finish) {
            iterator.remove()
        }
    }
}